package com.atguigu.gulimall.test.test;



public class Ttype2 {

    private String name;

    public static void main(String[] args) {
        Ttype2 ttype2 = new Ttype2();
        ttype2.name="刘君";

        Ttype2 ttype1 = new Ttype2();
        ttype1.name = "刘君";

        System.out.println(ttype1.equals(ttype2));

        String a = new String("我是刘君君");
        String b = new String("我是刘君君");
        System.out.println(a.equals(b));
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Ttype2){
            Ttype2 ttype2 = (Ttype2)obj;
            if (this.name.equals(ttype2.name)) {
                return true;
            }else {
                return false;
            }
        }else {
            return false;
        }
    }


}
